package cn.wangsy.contacts;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class Data {

	public static Map<String, String> UserData = new HashMap<String, String>();
	public static List<Contact> ContactsData = new ArrayList<Contact>();
	
	static{
		//用户信息
		UserData.put("1", "123");
		UserData.put("2", "abc");
		
		//通讯录信息
		Contact contact = new Contact();
		contact.setId("1");
		contact.setName("张三");
		contact.setHomePhone("123123");
		contact.setUnitPhone("888888");
		contact.setMobilePhone("13888");
		contact.setUnitAddress("北京市");
		ContactsData.add(contact);
		
	}
	
	
	public static Contact getContact(String id){
		for(Contact contact:ContactsData){
			if(id.equals(contact.getId()) || id.equals(contact.getName())){
				return contact;
			}
		}
		return null;
	}
	
}
